package flow.model;

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Shape;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Point2D;

import flow.conf.GraphConstant;
import flow.model.Element;
import flow.model.Vertex;

public class Marker extends Element{
	/*public Marker(Point2D.Double control,Vertex vertex,int type){
		
		super(GraphConstant.DEFAULT_ELEMENT_COLOR,3);
		owner =vertex;
		center =control;
		this.type=type;
		shape =new Ellipse2D.Double(control.x-radius,control.y-radius,2.0*radius,2.0*radius);
		selected=true;
	}*/
	public Marker(Point control,Vertex vertex,int type){
		
		super(GraphConstant.DEFAULT_ELEMENT_COLOR,3);
		owner =vertex;
		center =control;
		this.type=type;
		//shape =new Ellipse2D.Double(control.x-radius,control.y-radius,2.0*radius,2.0*radius);
		selected=true;
	}
	public Marker(Point control,Edge edge,int type){
		
		super(GraphConstant.DEFAULT_ELEMENT_COLOR,3);
		owner =edge;
		center =control;
		this.type=type;
		//shape =new Ellipse2D.Double(control.x-radius,control.y-radius,2.0*radius,2.0*radius);
		selected=true;
	}
	/*public void draw(Graphics2D g2D){
		g2D.draw(circle);
	}*/
	public Shape getShape(){
		return new Ellipse2D.Double(center.x-radius,center.y-radius,2.0*radius,2.0*radius);
	}
	Point/*2D.Double*/ getCenter(){
		return center;
	}
	public Element owner;
	//public Ellipse2D.Double circle;
	public int type;
	//public Point relativePoint;
	public Point/*2D.Double*/ center;
	static final double radius =4;
	@Override
	public boolean near(int x, int y) {
		// TODO Auto-generated method stub
		return getShape().getBounds().contains(x,y);
	}
}
